'''

                            Online Python Compiler.
                Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.

'''

a=input()
b=""
for i in a:
    if i=='('and i=='['and i=='{'and i=='<':
        b+=i
        if i==')' and i==']'and i=='}'and i=='>':
            if len(b)>0:
                if b[len (b)-1]=='('and i=='['and i=='{'and i=='<':
                    b==b[ : :-1]
                    
if len(b)<0:
    print('False')
else:
    print('True')